<?php

/**
 * Notificacion form base class.
 *
 * @method Notificacion getObject() Returns the current form's model object
 *
 * @package    Sanitas
 * @subpackage form
 * @author     Jose Antonio Sánchez Bedoya
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseNotificacionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'asunto'            => new sfWidgetFormInputText(),
      'texto'             => new sfWidgetFormTextarea(),
      'fecha_creacion'    => new sfWidgetFormDateTime(),
      'fecha_lanzamiento' => new sfWidgetFormDateTime(),
      'contacto_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contacto'), 'add_empty' => false)),
      'adjunto1'          => new sfWidgetFormInputText(),
      'adjunto_original1' => new sfWidgetFormInputText(),
      'adjunto2'          => new sfWidgetFormInputText(),
      'adjunto_original2' => new sfWidgetFormInputText(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
      'validated_at'      => new sfWidgetFormDateTime(),
      'is_validated'      => new sfWidgetFormInputCheckbox(),
      'removed_at'        => new sfWidgetFormDateTime(),
      'remove_it'         => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'asunto'            => new sfValidatorString(array('max_length' => 150)),
      'texto'             => new sfValidatorString(),
      'fecha_creacion'    => new sfValidatorDateTime(),
      'fecha_lanzamiento' => new sfValidatorDateTime(),
      'contacto_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contacto'))),
      'adjunto1'          => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'adjunto_original1' => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'adjunto2'          => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'adjunto_original2' => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
      'validated_at'      => new sfValidatorDateTime(array('required' => false)),
      'is_validated'      => new sfValidatorBoolean(array('required' => false)),
      'removed_at'        => new sfValidatorDateTime(array('required' => false)),
      'remove_it'         => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('notificacion[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Notificacion';
  }

}
